package com.fupan.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fupan.entity.Book;
import com.fupan.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author stec
 * @since 2023-02-13 04:28:56
 */
@RestController
@RequestMapping("/book")
public class BookController {


    @Autowired
    BookService bookService;


    @RequestMapping("topN")
    public List<Book> topN(Integer n) {

        Page<Book> pageBook = bookService.getPageBook(1, n);
        List<Book> topBooks = pageBook.getRecords();

        return topBooks;

    }


}

